import os,sys
from xmlReader_expat import DFSaxXmlParser

#获取当前路径
ROOT_PATH = os.path.split(__file__)[0]
print('当前工作目录:',ROOT_PATH) 
xmlUrl = os.path.join(ROOT_PATH,'Main.xml') # abc Main    
#f = open(xmlUrl,'r',encoding='utf-8') #读取文件
f = open(xmlUrl,'rb') #读取文件
xmlStr = f.read();
xmlStr = xmlStr.decode(encoding='utf-8')

dfSax = DFSaxXmlParser(xmlStr)

print("dfSax.rootNode.children",dfSax.rootNode.children);
#exit()
'''
items = dfSax.xmlData['catalog']
print("items",dfSax.rootNode,type(dfSax.rootNode))
for ele in dfSax.xmlData:
    print("xx ele= ",ele)
    #if ele not in dfSax.rootNode.children:
        #print("xx = ",ele)
'''

'''
items = items[1].children
for i,v in enumerate(items):    
    print('name=',items[i].name,'attr=',items[i].attr,'char=',items[i].char)
'''